package com.heima.models.common;

import lombok.Data;

@Data
public class Result {
    private Integer code;
    private String msg;
    private Object data;

    public Result(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public Result() {
    }

    // 成功返回
    public static Result success(Object data) {
        return new Result(200, "成功", data);
    }

    // 失败返回
    public static Result error(String msg) {
        return new Result(500, msg, null);
    }
}
